package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(30)"`
	Password string `gorm:"type:varchar(32)"`
}

type Article struct {
	gorm.Model
	Title     string `gorm:"type:varchar(60)"`
	Content   string `gorm:"type:text"`
	Img       string `gorm:"type:varchar(255)"`
	From      string `gorm:"type:varchar(60)"`
	LikeCount int    `gorm:"type:int"`
	UserId    int    `gorm:"type:int"`
	User      User   `gorm:"foreignerKey:UserId"`
}

type Like struct {
	gorm.Model
	UserId    int     `gorm:"type:int"`
	User      User    `gorm:"foreignerKey:UserId"`
	ArticleId int     `gorm:"type:int"`
	Article   Article `gorm:"foreignerKey:ArticleId"`
}
